<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/layui/css/layui.css"  media="all">
    <#include "/common/base.ftl"/>
    <script src="/static/layui/layui.js" charset="utf-8"></script>
    <script src="/static/layui/config.js"></script>
    <style>
        table, tr, td{
            border: 0px !important;
        }
        td{
            width: 33%;
        }
        .title{
            text-align: center;
            font-size: 25px;
            font-weight: bold;
        }
        .warn{
            margin-top: 20px;
            font-size: 14px;
            font-weight: bold;
        }
    </style>
</head>
<body>

<div class="wrapper wrapper-content">
    <div class="col-sm-12" id="finish_form">
        <p class="title">验证自提信息</p>
        <div class="row">
            <div class="col-sm-12">
                <fieldset>
                    <legend style="font-size: 15px">申请信息</legend>
                    <table class="table table-hover no-margins no-borders">
                        <tr>
                            <td>申请编号：<label id="uuid"></label></td>
                            <td >获取方式：<label id="transType"></label></td>
                            <td >病历类型：<label id="recType"></label></td>
                        </tr>
                        <tr>
                            <td >住院号：<label id="cureNo"></label></td>
                            <td >患者姓名：<label id="idCard_idcName"></label></td>
                            <td>支付状态：<label id="payStatus"></label></td>
                        </tr>
                        <tr>
                            <td>备注：<label id="rmk"></label></td>
                            <td >打印通途：<label id="printPurp"></label></td>
                            <td >病历份数：<label id="printCount"></label>份</td>
                        </tr>
                    </table>
                </fieldset>

                <p class="warn">请回填自提验证码</p>
                <input type="hidden" name="applyId"/>
                <input type="text" name="logisticsNo" lay-verify="required" lay-reqtext="请输入自提码！" placeholder="请输入自提码" class="layui-input ipt">

                <div class="hr-line-dashed" style="margin-top: 50px !important; border: 0px"></div>
                <div class="form-group text-right" style="width: 100%;position: relative">
                    <div class="col-sm-4 col-sm-offset-2" style="width: 100%;position: absolute;right: 0px;">
                        <button id="saveUserBtn" class="btn btn-primary" type="button" onclick="submit()">确定</button>
                        <button id="closeBtn" class="btn btn-white" onclick="closeLayer()" type="button">关闭</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function closeLayer() {
        parent.closeLayer();
    }
    function closeLayer2(msg) {
        parent.closeLayer2(msg);
    }

    var flag = true;
    function submit() {
        var logisticsNo = $("input[name='logisticsNo']").val();
        if(logisticsNo=="" || logisticsNo == null){
            layer.alert("请填写自提码");
            return;
        }
        if(!flag){
            layer.alert("请不要重复提交");
            return;
        }
        flag = false;
        //物流单号

        var applyId = $("input[name='applyId']").val();
        $.ajax({
            type: "POST",
            url: "/sys/finish/pickupNo",
            dataType: "json",
            data:{logisticsNo:logisticsNo,id:applyId},
            success: function (result) {
                if(result.code == '1'){
                    closeLayer2(result.msg);
                }else {
                    layer.alert("验证失败，"+result.msg);
                    flag = true;
                }
            },
            error: function (result) {
                layer.alert("操作异常，"+JSON.stringify(result));
                flag = true;
            }
        });
    }

    $(".ipt").on('input  propertychange',function(){
        //确保输入的是数字
        this.value = this.value.replace(/[^\d\.]/g, '');
    })
</script>
</html>